<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:p="http://primefaces.org/ui"
	xmlns:cc="http://java.sun.com/jsf/composite"	>

<cc:interface >
	<cc:attribute name="handler"	type="com.hemerasolutions.v2trainer.component.interfaces.list.ModalityIZListCompInterface" required="true"/>
	<cc:attribute name="editable"	type="java.lang.Boolean" 	default="true" />
</cc:interface>
	
<cc:implementation>
	<span id="#{cc.clientId}" >
		<p:accordionPanel id="accModalityItensity"  value="#{cc.attrs.handler.modality.intensityModTables}" var="intensityModTable">
			<p:tab title="#{msgs[intensityModTable.execution.name]}">
				<p:dataTable  id="imzTable" value="#{intensityModTable.intensityModZones}" var="intensityModZone"  editable="#{cc.attrs.editable}" editMode="cell" styleClass="intensityTable" emptyMessage="#{msgs.NoResults}">
					<p:column colspan="1"	styleClass="ui-table-button-row" style="max-height:15px !important;padding-top:0px !important;padding-bottom:0px !important;position:relative"  >
						<f:facet name="header">
							<p:commandButton action="#{cc.attrs.handler.toAddModalityItensityZone}"   update="imzTable"  title="#{msgs.Add}" 
								style="float:left;" 	icon="ui-icon-plus" styleClass="ui-table-button"  >
								<f:setPropertyActionListener target="#{cc.attrs.handler.selIntensityModTable}" value="#{intensityModTable}"/>
							</p:commandButton >
						</f:facet>
						<div class="ui-header"> 
							<p:commandButton action="#{cc.attrs.handler.upModalityItensityZone}"   update="imzTable"  title="#{msgs.Up}" 
								style="float:left;top:0px" 	icon="ui-icon-triangle-1-n" styleClass="ui-half-table-button"  >
								<f:setPropertyActionListener target="#{cc.attrs.handler.selIntensityModTable}" value="#{intensityModTable}"/>
								<f:setPropertyActionListener target="#{cc.attrs.handler.selIntensityModZone}" value="#{intensityModZone}"/>
							</p:commandButton >
							<p:commandButton action="#{cc.attrs.handler.downModalityItensityZone}"   update="imzTable"  title="#{msgs.Down}" 
								style="float:left;" 	icon="ui-icon-triangle-1-s" styleClass="ui-half-table-button"  >
								<f:setPropertyActionListener target="#{cc.attrs.handler.selIntensityModTable}" 	value="#{intensityModTable}"/>
								<f:setPropertyActionListener target="#{cc.attrs.handler.selIntensityModZone}" 	value="#{intensityModZone}"/>
							</p:commandButton >
						</div>
					</p:column>

					<p:column colspan="1" style="text-align:center;position:relative;max-height:15px !important;padding-top:0px !important;padding-bottom:0px !important"   >
						<f:facet name="header">	
							<h:outputText value="#{msgs.PhysicalCapacity}"  />
						</f:facet>	
						<p:cellEditor>
						    <f:facet name="output">
					            <p:selectOneMenu value="#{intensityModZone.physicalCapacity}" converter="#{genericConverter}"  styleClass="ui-selector-on-table"  style="width:100px" disabled="true"  >
					            	<f:selectItems value="#{cc.attrs.handler.modality.trainingType.physicalCapacitys}"  var="physicalCapacity"  itemDescription="#{msgs[physicalCapacity.description]}"
					            		itemLabel="#{msgs[physicalCapacity.name]}" itemValue="#{physicalCapacity}" />
					            </p:selectOneMenu>
						    </f:facet>
						    <f:facet name="input">
					            <p:selectOneMenu value="#{intensityModZone.physicalCapacity}" converter="#{genericConverter}" styleClass="ui-selector-on-table"   style="width:100px" >
					            	<f:selectItems value="#{cc.attrs.handler.modality.trainingType.physicalCapacitys}"  var="physicalCapacity" 	itemDescription="#{msgs[physicalCapacity.description]}"
					            		itemLabel="#{msgs[physicalCapacity.name]}" itemValue="#{physicalCapacity}" />
					            </p:selectOneMenu>
						    </f:facet>
						</p:cellEditor>		
					</p:column>
					<p:column colspan="1" style="min-width:150px;"  >
						<f:facet name="header">	
							<h:outputText value="#{msgs.Name}" />
						</f:facet>	
						<p:cellEditor>
						    <f:facet name="output">
						    	<h:outputText  value="#{intensityModZone.name}" />
						    </f:facet>
						    <f:facet name="input">
								<p:inputText  value="#{intensityModZone.name}"/>					       
						    </f:facet>
						</p:cellEditor>		
					</p:column>
					<p:column colspan="1" style="min-width:150px;"  >
						<f:facet name="header">	
							<h:outputText value="#{msgs.Alias}" />
						</f:facet>	
						<p:cellEditor>
						    <f:facet name="output">
						    	<h:outputText  value="#{intensityModZone.alias}" />
						    </f:facet>
						    <f:facet name="input">
								<p:inputText  value="#{intensityModZone.alias}"/>					       
						    </f:facet>
						</p:cellEditor>		
					</p:column>
					
					<p:column colspan="1"  style="white-space: nowrap;max-height:15px !important;padding:1px !important;min-width:120px"  >
						<f:facet name="header">
							<p:outputLabel value="#{msgs.IU_RPE}" title="#{msgs.IU_RPE_DESC}" />
							<p:outputLabel styleClass="ui-icon ui-icon-triangle-1-s" style="vertical-align:top;display: inline-block !important;"  />
						</f:facet>
						<p:cellEditor>
						    <f:facet name="output"> 
								<h:outputText  value="#{msgs[intensityModZone.lowRpe.name]}"/>
						    </f:facet> 
						    <f:facet name="input">
					            <p:selectOneMenu value="#{intensityModZone.lowRpe}" converter="#{genericConverter}"  styleClass="ui-selector-on-table"  
					            	style="white-space: nowrap;" >
					            	<f:selectItems value="#{cc.attrs.handler.fullRpes}"  var="rpe"  itemValue="#{rpe}"
					            		itemDescription="#{msgs[rpe.description]}"	itemLabel="#{rpe.value} - #{msgs[rpe.description]}"  />
					            </p:selectOneMenu>  
					        </f:facet>    
						</p:cellEditor>		
					</p:column>						
			
					<p:column colspan="1"  style="white-space: nowrap;max-height:15px !important;padding:1px !important;min-width:120px"  >
						<f:facet name="header">
							<p:outputLabel value="#{msgs.IU_RPE}" title="#{msgs.IU_RPE_DESC}" />
							<p:outputLabel styleClass="ui-icon ui-icon-triangle-1-n" style="vertical-align:top;display: inline-block !important;"  />
						</f:facet>
						<p:cellEditor>
						    <f:facet name="output"> 
								<h:outputText  value="#{msgs[intensityModZone.highRpe.name]}"/>
						    </f:facet> 
						    <f:facet name="input">
					            <p:selectOneMenu value="#{intensityModZone.highRpe}" converter="#{genericConverter}"  styleClass="ui-selector-on-table"  
					            	style="white-space: nowrap;">
					            	<f:selectItems value="#{cc.attrs.handler.fullRpes}"  var="rpe"  itemValue="#{rpe}"
					            		itemDescription="#{msgs[rpe.description]}"	itemLabel="#{rpe.value} - #{msgs[rpe.description]}"  />
					            </p:selectOneMenu> 
						    </f:facet>			
						</p:cellEditor>		
					</p:column>						

		
					<p:column colspan="1" headerText="#{msgs.Color}" width="20" style="text-align:center;max-height:15px !important;padding-top:0px !important;padding-bottom:0px !important" >
						<p:cellEditor >
						    <f:facet name="output">
						    	<p:inputText style="padding:0px;margin:0px;border:none"  value="#{intensityModZone.color}" type="color" readonly="true"   />	
						    </f:facet>
						    <f:facet name="input">
								<p:inputText style="padding:0px;margin:0px;border:none"   value="#{intensityModZone.color}" type="color"   />	
						    </f:facet>
						</p:cellEditor>		
					</p:column>						

					<p:column colspan="1" styleClass="ui-table-button-row"  >
						<p:commandButton action="#{cc.attrs.handler.deleteModalityItensityZone}"   update="imzTable"  title="#{msgs.Delete}" 
							style="height:100%;" 	icon="ui-icon-trash" styleClass="ui-table-button"  >
							<f:setPropertyActionListener target="#{cc.attrs.handler.selIntensityModTable}" value="#{intensityModTable}"/>
							<f:setPropertyActionListener target="#{cc.attrs.handler.selIntensityModZone}"  value="#{intensityModZone}"/>
						</p:commandButton >
					</p:column>
				</p:dataTable>
			</p:tab>					
		</p:accordionPanel>
	</span>
</cc:implementation>


</html>